package io.renren.wh.merchant.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.wh.merchant.entity.CashEntity;
import io.renren.wh.merchant.service.CashService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 *
 *
 * @author liulinqiu
 * @email liulinqiu1997@163.com
 * @date 2020-07-23 09:22:16
 */
@RestController
@RequestMapping("wh/cash")
public class CashController {
    @Autowired
    private CashService cashService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("hy:cash:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = cashService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("hy:cash:info")
    public R info(@PathVariable("id") Integer id){
		CashEntity cash = cashService.getById(id);

        return R.ok().put("cash", cash);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("hy:cash:save")
    public R save(@RequestBody CashEntity cash){
		cashService.save(cash);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("hy:cash:update")
    public R update(@RequestBody CashEntity cash){
		cashService.updateById(cash);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("hy:cash:delete")
    public R delete(@RequestBody Integer[] ids){
		cashService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
